package com.sasis.service.impl;
import java.util.List;

import com.sasis.model.DeptInfo;
import com.sasis.dao.DeptInfoDAO;
import com.sasis.service.impl.BaseManager;
import com.sasis.service.DeptInfoService;
//import com.sasis.service.UserManager;
import com.sasis.util.PageList;
import com.sasis.util.PageRequest;

public class DeptInfoServiceImpl extends BaseManager implements DeptInfoService{
private DeptInfoDAO deptInfoDao;
	
	
	public DeptInfoDAO getdeptInfoDao() {
		return deptInfoDao;
	}

	public void setdeptInfoDao(DeptInfoDAO deptInfoDao) {
		this.deptInfoDao = deptInfoDao;
	}
  	
	//list all info from dept table
	public List getAllDepts(){
		List list=getdeptInfoDao().selectAll();
		return list;
		
	}
	
	//list user and dept info
	public List selectRef(DeptInfo deptInfo){
		List list=getdeptInfoDao().selectRef(deptInfo);
		return list;
		
	}
	
	//public List getDeptsByParentID(int depId);
    //public List getDeptsByManager(int UserId);
    public DeptInfo getDeptInfoByID(int deptId){
    	DeptInfo deptInfo = new DeptInfo();
    	deptInfo.setId(deptId);
    	return deptInfoDao.selectByPrimaryKey(deptInfo);
    	
    }
    
    //insert by id
    public int insert(DeptInfo deptInfo){ 
    	return  deptInfoDao.insert(deptInfo);
    }
    
    //update by id
	public int update(DeptInfo deptInfo){
		return  deptInfoDao.updateByPrimaryKey(deptInfo);
		
	}
	
   //delete by id
	public int delete(DeptInfo deptInfo){
		
		return getdeptInfoDao().deleteByPrimaryKey(deptInfo);
		
	}

	public List getParentDepts(int deptId) { 
		return deptInfoDao.getParentDepts(deptId);
	}
	public PageList queryForPageList(String listStatementId,  
	    		Object parameterObject, PageRequest pageRequest){
		return deptInfoDao.queryForPageList(listStatementId,   parameterObject, pageRequest);
	}

}
